package jin.si.com.service.impl;

import jin.si.com.dao.UserOrderDao;
import jin.si.com.entity.*;
import jin.si.com.service.UserOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.annotation.WebServlet;
import java.util.List;

/**
 * @description: 实现类
 * @ClassName UserOrderServiceImpl
 * @Author MT
 * @Date 2021/5/14 10:26
 **/
@Service
public class UserOrderServiceImpl implements UserOrderService {
    @Autowired
    public UserOrderDao dao;

    //一对一
    @Override
    public R06Order_Vo getUserOrder(int id) {
        R06Order_Vo user=dao.getUserOrder(id);
        return user;
    }

    //一对多
    @Override
    public R06User_Vo getUserOrderList(int id) {
        R06User_Vo list=dao.getUserOrderList(id);
        R06User_Vo list2=dao.getUserOrderList(id);
        return list;
    }

    //多对多
    @Override
    public UserVo getUserProductList(int id) {
        UserVo user=dao.getUserProductList(id);
        UserVo user1=dao.getUserProductList(id);
        return user;
    }

    //多对多 商品对用户
    @Override
    public ProductVo2 getProductUserList(int id) {
        ProductVo2 product=dao.getProductUserList(id);
        return product;
    }

    //懒加载 一对多 用户对订单
    @Override
    public List<UserVo1> getUserOrder1() {
        List<UserVo1> list=dao.getUserOrder1();
        String sex = list.get(0).getSex();
        System.out.println(sex+"***********************************************");//按需加载
        return list;    //会发送另一条sql语句
    }

    //懒加载 一对一 订单对用户
    @Override
    public List<OrderVo2> getOrderUser1() {
        List<OrderVo2> list=dao.getOrderUser1();
        String orderCode = list.get(0).getOrderCode();
        System.out.println(orderCode+"***********************************************");//按需加载
        return list;
    }














}
